Digital Identity: Ethereum
デジタルID系のERCについて。
一覧
概要
on-chainにIdentityを書き込むための仕様・実装。利用用途は
SecurityToken向けのKYC
Delegated Executionのためのデータ登録
など。
実際に書き込むものは
アドレス
任意のデータ(KYC用のメタデータ、Delegated Execution用のパラメータなど)
上記二つのハッシュ
など
Identity
uPortの提唱
ERC-725のgas costを減らしたい
identityの作成は無償でoff-chainで行いたい
identityのownerごとに1コントラクトあるイメージ
delegatorを登録して代わりにtransactionを実行してもらうもの
仕様
delegateの追加・削除
attribute(identityに紐づくデータ)の追加・削除
implementation
ERC-902 Token Validation
tokenをtransfer出来るかどうかのcheck関数を追加する
code: interface
interface TokenValidator {
function check(
address _token,
address _subject
) public returns(byte result)
function check(
address _token,
address _from,
address _to,
uint256 _amount
) public returns (byte result)
}
Claim Registry
Identityのためのclaimを保持しておくregistryの仕様・実装
各仕様で目的は似ていて、何のデータを保持しておくかや追加の機能(recoveryなど)が異なる
code: ERC-735 interface
contract ERC735 {
struct Claim {
// トピック(e.g. 1.バイオメトリクス, 2. 住宅 など)
uint256 topic;
// 処理・検証の方法(e.g. 1. ECDSA, 2. RSAなど)
uint256 scheme;
// claimする人(contract or EOA)
address issuer;
// claimする人の署名
// keccak256(address identityHolder_address, uint256 _ topic, bytes data)
bytes signature;
// claimデータのハッシュ
bytes data;
// claimが置いてある場所
string uri;
}
// claimの取得、トピックごとのclaimIDの取得、claimの追加、claimの削除
function getClaim(bytes32 _claimId) public constant returns(uint256 topic, uint256 scheme, address issuer, bytes signature, bytes data, string uri);
function getClaimIdsByTopic(uint256 _ topic) public constant returns(bytes32[] claimIds);
function addClaim(uint256 _topic, uint256 _scheme, address _issuer, bytes _signature, bytes _data, string _uri) public returns (uint256 claimRequestId);
changeClaim(bytes32 _claimId, uint256 _topic, uint256 _scheme, address _issuer, bytes _signature, bytes _data, string _uri) returns (bool success);
function removeClaim(bytes32 _claimId) public returns (bool success);
// claimのリクエスト時、追加時、削除時、変更時のイベント
event ClaimRequested(uint256 indexed claimRequestId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
event ClaimAdded(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
event ClaimRemoved(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
event ClaimChanged(bytes32 indexed claimId, uint256 indexed topic, uint256 scheme, address indexed issuer, bytes signature, bytes data, string uri);
}
code: ERC-780 interface
contract EthereumClaimsRegistry {
mapping(address => mapping(address => mapping(bytes32 => bytes32))) public registry;
event ClaimSet(address indexed issuer, address indexed subject, bytes32 indexed key, bytes32 value, uint updatedAt);
event ClaimRemoved(address indexed issuer, address indexed subject, bytes32 indexed key, uint removedAt);
function setClaim(address subject, bytes32 key, bytes32 value)
function setSelfClaim(bytes32 key, bytes32 value)
function getClaim(address issuer, address subject, bytes32 key) public view returns(bytes32)
function removeClaim(address issuer, address subject, bytes32 key)
}
code: ERC-939 interface
contract ERC939 {
bytes32 public constant TYPE_SUBJECT_OWNERSHIP = keccak256("pub_subject_ownership");
bytes32 public constant TYPE_RETRACTED_CLAIM = keccak256("pub_retract_claim");
event ClaimAdded(bytes32 subject, bytes32 issuer, bytes32 claimType, bytes data);
struct Claim {
bytes32 subject;
bytes32 claimType;
address issuer;
uint64 timestamp;
bytes data;
}
function addClaim(bytes32 subject, bytes32 claimType, bytes data) public returns (uint256 index);
function validateClaim(bytes32 subject, bytes32 claimType, bytes data, uint8 v, bytes32 r, bytes32 s) public returns (bool);
function getClaim(bytes32 subject, uint256 index) public view returns (bytes32 claimHash);
function getClaim(bytes32 claimHash) public view returns (address subject, address issuer, bytes32 claimType, uint64 timestamp, bytes32 dataHash);
function readData(bytes32 claimHash) public view returns (bytes data);
function readData(bytes32 claimHash, uint256 padding) public view returns (bytes32);
function claimsOf(bytes32 subject) public view returns (uint256 number);
function findClaims(bytes32 subject, address issuer, bytes32 claimType) public view returns (bytes32[] claims);
}
code: ERC-1484 interface
interface ERC1484 {
// Identity View Functions /////////////////////////////////////////////////////////////////////////////////////////
function identityExists(uint ein) external view returns (bool);
function hasIdentity(address _address) external view returns (bool);
function getEIN(address _address) external view returns (uint ein);
function isAssociatedAddressFor(uint ein, address _address) external view returns (bool);
function isProviderFor(uint ein, address provider) external view returns (bool);
function isResolverFor(uint ein, address resolver) external view returns (bool);
function getIdentity(uint ein) external view
returns (address recoveryAddress, address[] associatedAddresses, address[] providers, address[] resolvers);
// Identity Management Functions ///////////////////////////////////////////////////////////////////////////////////
function createIdentity(address recoveryAddress, address provider, address[] resolvers) external returns (uint ein);
function createIdentityDelegated(
address recoveryAddress, address associatedAddress, address[] resolvers,
uint8 v, bytes32 r, bytes32 s, uint timestamp
) external returns (uint ein);
function addAssociatedAddressDelegated(
address approvingAddress, address addressToAdd, uint82 v, bytes322 r, bytes322 s, uint2 timestamp ) external;
function removeAssociatedAddressDelegated(
address addressToRemove, uint8 v, bytes32 r, bytes32 s, uint timestamp
) external;
function addProviders(address[] providers) external;
function addProvidersFor(uint ein, address[] providers) external;
function removeProviders(address[] providers) external;
function removeProvidersFor(uint ein, address[] providers) external;
function addResolversFor(uint ein, address[] resolvers) external;
function removeResolversFor(uint ein, address[] resolvers) external;
// Recovery Management Functions ///////////////////////////////////////////////////////////////////////////////////
function triggerRecoveryAddressChangeFor(uint ein, address newRecoveryAddress) external;
function triggerRecovery(uint ein, address newAssociatedAddress, uint8 v, bytes32 r, bytes32 s) external;
function triggerPoisonPill(uint ein, address[] firstChunk, address[] lastChunk, bool clearResolvers) external;
// Events //////////////////////////////////////////////////////////////////////////////////////////////////////////
event IdentityCreated(
address indexed initiator, uint indexed ein,
address recoveryAddress, address associatedAddress, address provider, address[] resolvers, bool delegated
);
event AssociatedAddressAdded (address indexed initiator, uint indexed ein, address approvingAddress, address addedAddress);
event AssociatedAddressRemoved (address indexed initiator, uint indexed ein, address removedAddress);
event ProviderAdded (address indexed initiator, uint indexed ein, address provider, bool delegated);
event ProviderRemoved (address indexed initiator, uint indexed ein, address provider, bool delegated);
event ResolverAdded (address indexed initiator, uint indexed ein, address resolvers);
event ResolverRemoved (address indexed initiator, uint indexed ein, address resolvers);
event RecoveryAddressChangeTriggered(
address indexed initiator, uint indexed ein, address oldRecoveryAddress, address newRecoveryAddress
);
event RecoveryTriggered(
address indexed initiator, uint indexed ein, address[] oldAssociatedAddresses, address newAssociatedAddress
);
event IdentityPoisoned (address indexed initiator, uint indexed ein, address recoveryAddress, bool resolversReset);
}
リンク
origin protocol
DID